//创建连接对象
if (window.XMLHttpRequest){
    var request = new XMLHttpRequest();//创建ajax链接对象
}
else if (window.ActiveXObject){
    var request = new ActiveXObject();
}
function showComment(id,page){
    // alert(id);
    //clickup(id);
    if (request != null){
        request.onreadystatechange = link;
        // alert(page);
        request.open("GET","clickUp.php?newsId="+id+"&page="+page,true)
        request.send();

    }
}
function pinglun(id){
    var str = document.getElementById("plc").value;
    if (request != null){
        request.onreadystatechange = plphp(1);
        // alert(str);
        request.open("GET","CommentWriter.php?newsId="+id+"&content="+str,true)
        request.send();

    }
}
//连接获取到php传回的文本
function link(){
    if (request.readyState == 4 && request.status == 200) {
        // alert( request.responseText);
        document.getElementById("pinglun").innerHTML = request.responseText;
    }
}
function plphp(id){
    if (request.readyState == 4 && request.status == 200) {
        // alert( request.responseText);
        document.getElementById("plc").value = "";
        //showComment(id,1);
        location.reload();
    }
}

function index(){
    window.location.href="index.php";
}